﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace OAuth2Authorizer.Microsoft
{

    [DataContract]
    internal class MicrosoftAccessToken
    {
        [DataMember(Name = "access_token")]
        public string AccessToken { get; set; }

        [DataMember(Name = "uid")]
        public string Uid { get; set; }

        [DataMember(Name = "token_type")]
        public string TokenType { get; set; }

        [DataMember(Name = "expires_in")]
        public string ExpiresIn { get; set; }

        [DataMember(Name = "id_token")]
        public string IdToken { get; set; }

        [DataMember(Name = "refresh_token")]
        public string RefreshToken { get; set; }

        public AccessTokenResponse AsAccessTokenResponse()
        {
            var accessToken = new AccessTokenResponse(AccessToken, TokenType);
            accessToken.ResponseTokens.Add("uid", Uid);
            return accessToken;
        }
    }
}
